package com.muchfish.reactor.api;

import reactor.core.publisher.Flux;

public class ReactorCombineLatestExample {
    public static void main(String[] args) {
        Flux<Integer> source1 = Flux.just(1, 2, 3);
        Flux<Integer> source2 = Flux.just(4, 5, 6);

        // 合并两个数据流的最新元素
        Flux<Integer> combinedFlux = Flux.combineLatest(source1, source2, (a, b) -> a + b);

        combinedFlux.subscribe(System.out::println);
    }
}
